Skip to content

Expose the Workflow Task attempt to Local Activities - #2127

Open
moetemp wants to merge 5 commits into
mainfrom
moe/activity-workflow-task-info
Open

moetemp wants to merge 5 commits into
mainfrom
moe/activity-workflow-task-info

Conversation

@moetemp

@moetemp moetemp commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

What was changed

This PR adds activity.Info.workflow_task for Local Activities. It contains the started event ID, attempt and optional start time. Other Activities receive None. The API is experimental.

Why?

A Local Activity can execute again after a Workflow Task retry. This value identifies the task that dispatched each execution.

Reviewer's guide

  1. Start with WorkflowTaskAttempt and Info.workflow_task in temporalio/activity.py. The field stays optional for Activities without Workflow Task information.
  2. Check the conversion in temporalio/worker/_activity.py. An absent task or timestamp stays None.
  3. Read test_activity_info_workflow_task in tests/worker/test_activity.py. It compares all fields with History and checks a regular Activity. Workflow Task retry behavior is owned by Core.

Checklist

  • Format and lint passed.
  • Activity tests passed against the PR's Core pin.

@moetemp
moetemp marked this pull request as ready for review November 14, 2026 00:56
@moetemp
moetemp requested a review from a team as a code owner November 14, 2026 00:56
@moetemp
moetemp added this pull request to stack #2130 November 14, 2026 01:00
@moetemp
moetemp removed this pull request from stack #2130 November 15, 2026 08:27
@moetemp
moetemp changed the base branch from main to moe/fix-flaky-worker-shutdown-tests November 15, 2026 18:50
@moetemp
moetemp force-pushed the moe/activity-workflow-task-info branch 2 times, most recently from 1a718b8 to 88cc83e Compare November 15, 2026 20:23
@moetemp
moetemp changed the base branch from moe/fix-flaky-worker-shutdown-tests to moe/stack-only-wait-for-worker-polls November 16, 2026 17:13
@moetemp
moetemp force-pushed the moe/activity-workflow-task-info branch from 88cc83e to e982e2a Compare November 16, 2026 17:14
@moetemp
moetemp changed the base branch from moe/stack-only-wait-for-worker-polls to moe/fix-flaky-worker-shutdown-tests November 16, 2026 17:32
@moetemp
moetemp force-pushed the moe/activity-workflow-task-info branch 2 times, most recently from 2c3fa47 to 1bb78ad Compare November 16, 2026 19:42
@moetemp
moetemp added this pull request to stack #2139 November 18, 2026 01:19
@moetemp
moetemp removed this pull request from stack #2139 November 22, 2026 21:24
@moetemp
moetemp added this pull request to stack #2156 November 22, 2026 21:24
@moetemp
moetemp force-pushed the moe/activity-workflow-task-info branch from 1bb78ad to 61e632d Compare November 23, 2026 22:34
Base automatically changed from moe/fix-flaky-worker-shutdown-tests to main November 25, 2026 23:53
A Local Activity runs again with the same Activity id and with attempt 1 when its Workflow Task is
retried, and nothing in `activity.Info` tells the two executions apart or orders them.
`Info.workflow_task` has the started event id, the attempt and the started time of that task,
which Core sends for a Local Activity.
Each PR with a change that users see needs a fragment.
@VegetarianOrc
VegetarianOrc force-pushed the moe/activity-workflow-task-info branch from ede7c0c to d0e5375 Compare November 25, 2026 23:53
@moetemp moetemp changed the title feat: add the dispatching Workflow Task to activity.Info for a Local Activity Expose the Workflow Task attempt to Local Activities Nov 27, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant